package com.sxzt.core.test;

import com.sxzt.core.data.BaseResponse;
import com.sxzt.core.enum_status.BaseOut;
import com.sxzt.core.result.GlobalResponseBuilder;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomResponseConcreteBuilder<T> implements GlobalResponseBuilder<T> {

    private BaseOut baseOut;

    private CustomResponse<T> customResponse;

    private String html;

    private Long timestamp;

    public CustomResponseConcreteBuilder(BaseOut baseOut) {
        this.baseOut = baseOut;
        customResponse = new CustomResponse<>();
    }

    @Override
    public GlobalResponseBuilder<T> buildOther() {

        customResponse.setTimestamp(new Date().getTime())
                .setHtml(html);
        return GlobalResponseBuilder.super.buildOther();
    }

    @Override
    public BaseResponse<T> getResponse() {
        return customResponse;
    }
}
